﻿
using LMM_Editor.Classes.CustomControls;
using LMM_Editor.Classes.Entities;
using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace LMM_Editor.Classes.System
{
    public class ToolCreateEntity : Tool
    {

        public ToolCreateEntity()
        {
            name = "Tool_CreateEntity";
            description = "Creates the selected entity when the mouse is clicked.";
            tooltype = ToolType.Create;
        }

        public override IEntity useTool(double x, double y, Control parent, IEntity entity)
        {
            // Override this for tool function
            IEntity ent = new IEntity();
            CustomLabel l = new CustomLabel();
            CustomLabelProperties props = new CustomLabelProperties();
            ent.propertyWrapper = props;
            props.parent = l;
            l.Name = "Entity 123";
            l.Text = "Hello there you created an entity!";
            l.Size = new Size(128, 64);
            l.Location = new Point((int)x-parent.Left, (int)y-parent.Top);
            l.Parent = parent;
            l.Font = new Font(LMMSystem.fonts.Families[0], 16);
            //l.BorderStyle = BorderStyle.Fixed3D;
            l.BorderColor = Color.AliceBlue;
            l.BackColor = Color.BurlyWood;
            
            // Add the label to the parent
            EntityManager.entities.Add(ent);
            parent.Controls.Add(l);
            l.BringToFront();
            ent.component = l;
            return ent;
        }
    }
}
